using Engine;
using Game;

namespace SCIENEW {
    public class MetalNBlock : DefaultNBlock, IMaterialBlock {
        public Materials Material;
        public Materials GetMaterial() => Material;

        public MetalNBlock(Materials material) : base(material + "NormalBlock", IndustrialModLoader.BaseTexture, material == Materials.Steel ? Color.White : MaterialsUtils.GetColor(material), material == Materials.Steel ? 228 : 180) {
            Material = material;
            DisplayName = string.Format(LanguageControl.Get("NormalBlocks", "Names", "MetalNBlock"), material.ToDisplayName());
            Description = string.Format(LanguageControl.Get("NormalBlocks", "Descriptions", "MetalNBlock"), material.ToDisplayName());
            Texture = material == Materials.Steel ? IndustrialModLoader.IETexture : IndustrialModLoader.BaseTexture;
        }

        public override int GetMaxStacking(int value) => 4;

        public override CraftingRecipe[] GenerateProceduralRecipe(int value) {
            CraftingRecipe recipe = new() {
                ResultValue = NormalBlockManager.GetNormalBlockID(this),
                ResultCount = 1,
                RequiredHeatLevel = 0,
                RequiredPlayerLevel = 1,
                Ingredients = new string[36],
                Description = $"合并{Material.ToDisplayName()}锭得到大{Material.ToDisplayName()}块"
            };
            recipe.Ingredients[0] = recipe.Ingredients[1] = recipe.Ingredients[2] = recipe.Ingredients[6] = recipe.Ingredients[7] = recipe.Ingredients[8] = recipe.Ingredients[12] = recipe.Ingredients[13] = recipe.Ingredients[14] = IECraftingRecipesManager.BlockToIngredient(ItemsBlockManager.GetItemIdByMaterial<MetalIngotItem>(Material));
            return [recipe];
        }
    }
}